home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- echo Checking status of reboot and shutdown.
-
- PKG_Path=$1
- ASK=$PKG_Path/ask
- ADD=$PKG_Path/ADDTO.rc
- Targets="reboot halt"
- Location=$2
- TimeShift=$Location/usr/etc/timeshift
- RC=$Location/etc/rc
-
- if [ ! -f $TimeShift ]
- then echo $TimeShift not installed!
- echo Installation cannot be performed.
- echo Check Logfile
- exit 1
- fi
-
- status=0
- for Target in $Targets
- do
- File=$Location/usr/etc/$Target
- if [ -f $File ]
- then if /usr/ucb/what $File | grep -s 'Berkeley'
- then echo $File real
- if mv $File $File.real
- then echo Moved $File to $File.real
- echo Linking $TimeShift $File
- ln $TimeShift $File
- else echo "Could not rename $File"
- echo Installation aborted. >&2
- exit 1
- fi
- else echo $Target fake
- echo Removing potentially older version of $File
- rm $File
- echo Linking $TimeShift $File
- ln $TimeShift $File
- fi
- else echo $File not present >&2
- status=1
- fi
- done
-
- $ASK 'Should I modify you /etc/rc file?
- If you decline you will have to add the hooks yourself.' "Do Nothing" "Modify /etc/rc"
-
- if [ $? -eq 1 ]
- then echo "Remember to add the contents of ADDTO.rc to an rc file."
- exit 0
- fi;
-
- if grep timeshift:: $RC
- then echo 'Timeshift was already installed.'
- echo 'Not changing /etc/rc'
- exit 0
- fi
-
- rm -f $RC.pre_timeshift
- cp -p $RC $RC.pre_timeshift
-
- chmod +w $RC
- ed $RC << %EOF%
- /Configure kern-loaded drivers/-1r $ADD
- w
- %EOF%
- chmod -w $RC
-